using System;
using System.Collections;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Globalization;
using System.Runtime.CompilerServices;
using PickGold.Charting;
using PickGold.Charting.Utilities;

namespace PickGold.Charting.ChartTypes
{
	internal class RadarChart : IChartType, IDisposable, ICircularChartType
	{
		private bool _autoLabelPosition = true;
		private LabelAlignmentStyles _labelPosition = LabelAlignmentStyles.Top;

		internal void AddSelectionPath(ChartArea area, GraphicsPath selectionPath, PointF[] dataPointPos, int firstPointIndex, int secondPointIndex, PointF centerPoint, int borderWidth)
		{
			PointF middlePoint = this.GetMiddlePoint(dataPointPos[firstPointIndex], dataPointPos[secondPointIndex]);
			PointF empty = PointF.Empty;
			if (firstPointIndex > 0)
			{
				empty = this.GetMiddlePoint(dataPointPos[firstPointIndex], dataPointPos[firstPointIndex - 1]);
			}
			else if ((firstPointIndex == 0) && (area.CircularSectorsNumber == (dataPointPos.Length - 1)))
			{
				empty = this.GetMiddlePoint(dataPointPos[firstPointIndex], dataPointPos[dataPointPos.Length - 2]);
			}
			if (!centerPoint.IsEmpty)
			{
				selectionPath.AddLine(centerPoint, middlePoint);
				selectionPath.AddLine(middlePoint, dataPointPos[firstPointIndex]);
				if (empty.IsEmpty)
				{
					selectionPath.AddLine(dataPointPos[firstPointIndex], centerPoint);
				}
				else
				{
					selectionPath.AddLine(dataPointPos[firstPointIndex], empty);
					selectionPath.AddLine(empty, centerPoint);
				}
			}
			else
			{
				GraphicsPath addingPath = new GraphicsPath();
				if (!empty.IsEmpty)
				{
					addingPath.AddLine(empty, dataPointPos[firstPointIndex]);
				}
				addingPath.AddLine(dataPointPos[firstPointIndex], middlePoint);
				try
				{
					addingPath.Widen(new Pen(Color.Black, (float)(borderWidth + 2)));
					addingPath.Flatten();
				}
				catch (OutOfMemoryException)
				{
				}
				catch (ArgumentException)
				{
				}
				selectionPath.AddPath(addingPath, false);
			}
		}

		public void AddSmartLabelMarkerPositions(CommonElements common, ChartArea area, Series series, ArrayList list)
		{
			PointF[] tfArray = this.GetPointsPosition(common.graph, area, series);
			int num = 0;
			int index = 0;
			foreach (DataPoint point in series.Points)
			{
				Color markerColor = point.MarkerColor;
				MarkerStyle markerStyle = point.MarkerStyle;
				if (this.GetDrawingStyle(series, point) == RadarDrawingStyle.Marker)
				{
					markerColor = point.Color;
				}
				SizeF size = this.GetMarkerSize(common.graph, common, area, point, point.MarkerSize, point.MarkerImage);
				if ((markerStyle != MarkerStyle.None) || (point.MarkerImage.Length > 0))
				{
					if (markerColor.IsEmpty)
					{
						markerColor = point.Color;
					}
					if (num == 0)
					{
						PointF relativePoint = common.graph.GetRelativePoint(tfArray[index]);
						size = common.graph.GetRelativeSize(size);
						RectangleF ef2 = new RectangleF(relativePoint.X - (size.Width / 2f), relativePoint.Y - (size.Height / 2f), size.Width, size.Height);
						list.Add(ef2);
					}
					num++;
					if (series.MarkerStep == num)
					{
						num = 0;
					}
				}
				index++;
			}
		}

		public void Dispose()
		{
			this.Dispose(true);
			GC.SuppressFinalize(this);
		}

		protected virtual void Dispose(bool disposing)
		{
		}

		internal void DrawLabels(ChartArea area, ChartGraphics graph, CommonElements common, PointF markerPosition, int markerSize, DataPoint point, Series ser, int pointIndex)
		{
			string label = point.Label;
			bool isValueShownAsLabel = point.IsValueShownAsLabel;
			if ((!point.IsEmpty && ((ser.IsValueShownAsLabel || isValueShownAsLabel) || (label.Length > 0))) || (isValueShownAsLabel || (label.Length > 0)))
			{
				using (StringFormat format = new StringFormat())
				{
					string str2;
					int num;
					format.Alignment = StringAlignment.Near;
					format.LineAlignment = StringAlignment.Center;
					if (label.Length == 0)
					{
						str2 = ValueConverter.FormatValue(ser.Chart, point, point.Tag, point.YValues[0], point.LabelFormat, ser.YValueType, ChartElementType.DataPoint);
					}
					else
					{
						str2 = point.ReplaceKeywords(label);
					}
					SizeF size = new SizeF((float)markerSize, (float)markerSize);
					SizeF relativeSize = graph.MeasureString(str2, point.Font, new SizeF(1000f, 1000f), StringFormat.GenericTypographic);
					SizeF ef3 = new SizeF(relativeSize.Width, relativeSize.Height);
					ef3.Height += ef3.Height / 2f;
					ef3.Width += ef3.Width / ((float)str2.Length);
					this._autoLabelPosition = true;
					string strA = point["LabelStyle"];
					if ((strA == null) || (strA.Length == 0))
					{
						strA = ser["LabelStyle"];
					}
					if ((strA != null) && (strA.Length > 0))
					{
						this._autoLabelPosition = false;
						if (string.Compare(strA, "Auto", StringComparison.OrdinalIgnoreCase) != 0)
						{
							if (string.Compare(strA, "Center", StringComparison.OrdinalIgnoreCase) != 0)
							{
								if (string.Compare(strA, "Bottom", StringComparison.OrdinalIgnoreCase) != 0)
								{
									if (string.Compare(strA, "TopLeft", StringComparison.OrdinalIgnoreCase) != 0)
									{
										if (string.Compare(strA, "TopRight", StringComparison.OrdinalIgnoreCase) != 0)
										{
											if (string.Compare(strA, "BottomLeft", StringComparison.OrdinalIgnoreCase) != 0)
											{
												if (string.Compare(strA, "BottomRight", StringComparison.OrdinalIgnoreCase) != 0)
												{
													if (string.Compare(strA, "Left", StringComparison.OrdinalIgnoreCase) != 0)
													{
														if (string.Compare(strA, "Right", StringComparison.OrdinalIgnoreCase) != 0)
														{
															if (string.Compare(strA, "Top", StringComparison.OrdinalIgnoreCase) != 0)
															{
																throw new ArgumentException(SR.ExceptionCustomAttributeValueInvalid(strA, "LabelStyle"));
															}
															this._labelPosition = LabelAlignmentStyles.Top;
														}
														else
														{
															this._labelPosition = LabelAlignmentStyles.Right;
														}
													}
													else
													{
														this._labelPosition = LabelAlignmentStyles.Left;
													}
												}
												else
												{
													this._labelPosition = LabelAlignmentStyles.BottomRight;
												}
											}
											else
											{
												this._labelPosition = LabelAlignmentStyles.BottomLeft;
											}
										}
										else
										{
											this._labelPosition = LabelAlignmentStyles.TopRight;
										}
									}
									else
									{
										this._labelPosition = LabelAlignmentStyles.TopLeft;
									}
								}
								else
								{
									this._labelPosition = LabelAlignmentStyles.Bottom;
								}
							}
							else
							{
								this._labelPosition = LabelAlignmentStyles.Center;
							}
						}
						else
						{
							this._autoLabelPosition = true;
						}
					}
					if (this._autoLabelPosition)
					{
						this._labelPosition = this.GetAutoLabelPosition(area, ser, pointIndex);
					}
					PointF relativePoint = new PointF(markerPosition.X, markerPosition.Y);
					switch (this._labelPosition)
					{
						case LabelAlignmentStyles.Top:
							format.Alignment = StringAlignment.Center;
							relativePoint.Y -= size.Height / 1.75f;
							relativePoint.Y -= ef3.Height / 2f;
							goto Label_054D;

						case LabelAlignmentStyles.Bottom:
							format.Alignment = StringAlignment.Center;
							relativePoint.Y += size.Height / 1.75f;
							relativePoint.Y += ef3.Height / 2f;
							goto Label_054D;

						case (LabelAlignmentStyles.Bottom | LabelAlignmentStyles.Top):
							goto Label_054D;

						case LabelAlignmentStyles.Right:
							relativePoint.X += size.Height / 1.75f;
							goto Label_054D;

						case LabelAlignmentStyles.Left:
							format.Alignment = StringAlignment.Far;
							relativePoint.X -= size.Height / 1.75f;
							goto Label_054D;

						case LabelAlignmentStyles.TopLeft:
							format.Alignment = StringAlignment.Far;
							relativePoint.X -= size.Height / 1.75f;
							relativePoint.Y -= size.Height / 1.75f;
							relativePoint.Y -= ef3.Height / 2f;
							goto Label_054D;

						case LabelAlignmentStyles.BottomRight:
							relativePoint.X += size.Height / 1.75f;
							relativePoint.Y += size.Height / 1.75f;
							relativePoint.Y += ef3.Height / 2f;
							goto Label_054D;

						case LabelAlignmentStyles.Center:
							format.Alignment = StringAlignment.Center;
							break;

						case LabelAlignmentStyles.TopRight:
							relativePoint.X += size.Height / 1.75f;
							relativePoint.Y -= size.Height / 1.75f;
							relativePoint.Y -= ef3.Height / 2f;
							goto Label_054D;

						case LabelAlignmentStyles.BottomLeft:
							format.Alignment = StringAlignment.Far;
							relativePoint.X -= size.Height / 1.75f;
							relativePoint.Y += size.Height / 1.75f;
							relativePoint.Y += ef3.Height / 2f;
							goto Label_054D;
					}
				Label_054D:
					num = point.LabelAngle;
					if (str2.Trim().Length != 0)
					{
						if (ser.SmartLabelStyle.Enabled)
						{
							relativePoint = graph.GetRelativePoint(relativePoint);
							markerPosition = graph.GetRelativePoint(markerPosition);
							relativeSize = graph.GetRelativeSize(relativeSize);
							size = graph.GetRelativeSize(size);
							relativePoint = area.smartLabels.AdjustSmartLabelPosition(common, graph, area, ser.SmartLabelStyle, relativePoint, relativeSize, format, markerPosition, size, this._labelPosition);
							if (!relativePoint.IsEmpty)
							{
								relativePoint = graph.GetAbsolutePoint(relativePoint);
							}
							relativeSize = graph.GetAbsoluteSize(relativeSize);
							num = 0;
						}
						if (!relativePoint.IsEmpty)
						{
							relativePoint = graph.GetRelativePoint(relativePoint);
							RectangleF empty = RectangleF.Empty;
							ef3 = graph.GetRelativeSize(relativeSize);
							ef3.Height += ef3.Height / 8f;
							empty = PointChart.GetLabelPosition(graph, relativePoint, ef3, format, true);
							using (Brush brush = new SolidBrush(point.LabelForeColor))
							{
								graph.DrawPointLabelStringRel(common, str2, point.Font, brush, relativePoint, format, num, empty, point.LabelBackColor, point.LabelBorderColor, point.LabelBorderWidth, point.LabelBorderDashStyle, ser, point, pointIndex);
							}
						}
					}
				}
			}
		}

		protected virtual LabelAlignmentStyles GetAutoLabelPosition(ChartArea area, Series series, int pointIndex)
		{
			LabelAlignmentStyles top = LabelAlignmentStyles.Top;
			float num = (360f / ((float)area.CircularSectorsNumber)) * pointIndex;
			if (num == 0f)
			{
				return LabelAlignmentStyles.TopRight;
			}
			if ((num >= 0f) && (num <= 45f))
			{
				return LabelAlignmentStyles.Top;
			}
			if ((num >= 45f) && (num <= 90f))
			{
				return LabelAlignmentStyles.TopRight;
			}
			if ((num >= 90f) && (num <= 135f))
			{
				return LabelAlignmentStyles.BottomRight;
			}
			if ((num >= 135f) && (num <= 180f))
			{
				return LabelAlignmentStyles.BottomRight;
			}
			if ((num >= 180f) && (num <= 225f))
			{
				return LabelAlignmentStyles.BottomLeft;
			}
			if ((num >= 225f) && (num <= 270f))
			{
				return LabelAlignmentStyles.BottomLeft;
			}
			if ((num >= 270f) && (num <= 315f))
			{
				return LabelAlignmentStyles.TopLeft;
			}
			if ((num >= 315f) && (num <= 360f))
			{
				top = LabelAlignmentStyles.TopLeft;
			}
			return top;
		}

		protected virtual RadarDrawingStyle GetDrawingStyle(Series ser, DataPoint point)
		{
			RadarDrawingStyle area = RadarDrawingStyle.Area;
			if (!point.IsCustomPropertySet("RadarDrawingStyle") && !ser.IsCustomPropertySet("RadarDrawingStyle"))
			{
				return area;
			}
			string strA = point.IsCustomPropertySet("RadarDrawingStyle") ? point["RadarDrawingStyle"] : ser["RadarDrawingStyle"];
			if (string.Compare(strA, "Area", StringComparison.OrdinalIgnoreCase) == 0)
			{
				return RadarDrawingStyle.Area;
			}
			if (string.Compare(strA, "Line", StringComparison.OrdinalIgnoreCase) == 0)
			{
				return RadarDrawingStyle.Line;
			}
			if (string.Compare(strA, "Marker", StringComparison.OrdinalIgnoreCase) != 0)
			{
				throw new InvalidOperationException(SR.ExceptionCustomAttributeValueInvalid(strA, "RadarDrawingStyle"));
			}
			return RadarDrawingStyle.Marker;
		}

		internal double GetEmptyPointValue(DataPoint point, int pointIndex)
		{
			Series series = point.series;
			double d = 0.0;
			double naN = 0.0;
			int num3 = 0;
			int num4 = series.Points.Count - 1;
			string strA = "";
			if (series.EmptyPointStyle.IsCustomPropertySet("EmptyPointValue"))
			{
				strA = series.EmptyPointStyle["EmptyPointValue"];
			}
			else if (series.IsCustomPropertySet("EmptyPointValue"))
			{
				strA = series["EmptyPointValue"];
			}
			if (string.Compare(strA, "Zero", StringComparison.OrdinalIgnoreCase) == 0)
			{
				return 0.0;
			}
			for (int i = pointIndex; i >= 0; i--)
			{
				if (!series.Points[i].IsEmpty)
				{
					d = series.Points[i].YValues[0];
					num3 = i;
					break;
				}
				d = double.NaN;
			}
			for (int j = pointIndex; j < series.Points.Count; j++)
			{
				if (!series.Points[j].IsEmpty)
				{
					naN = series.Points[j].YValues[0];
					num4 = j;
					break;
				}
				naN = double.NaN;
			}
			if (double.IsNaN(d))
			{
				if (double.IsNaN(naN))
				{
					d = 0.0;
				}
				else
				{
					d = naN;
				}
			}
			if (double.IsNaN(naN))
			{
				naN = d;
			}
			if (series.Points[num4].XValue == series.Points[num3].XValue)
			{
				return ((d + naN) / 2.0);
			}
			double num7 = (d - naN) / (series.Points[num4].XValue - series.Points[num3].XValue);
			return ((-num7 * (point.XValue - series.Points[num3].XValue)) + d);
		}

		public virtual Image GetImage(ChartTypeRegistry registry)
		{
			return (Image)registry.ResourceManager.GetObject(this.Name + "ChartType");
		}

		public virtual LegendImageStyle GetLegendImageStyle(Series series)
		{
			if (series != null)
			{
				switch (this.GetDrawingStyle(series, new DataPoint(series)))
				{
					case RadarDrawingStyle.Line:
						return LegendImageStyle.Line;

					case RadarDrawingStyle.Marker:
						return LegendImageStyle.Marker;
				}
			}
			return LegendImageStyle.Rectangle;
		}

		protected virtual SizeF GetMarkerSize(ChartGraphics graph, CommonElements common, ChartArea area, DataPoint point, int markerSize, string markerImage)
		{
			SizeF size = new SizeF((float)markerSize, (float)markerSize);
			if ((graph != null) && (graph.Graphics != null))
			{
				size.Width = (markerSize * graph.Graphics.DpiX) / 96f;
				size.Height = (markerSize * graph.Graphics.DpiY) / 96f;
			}
			if (markerImage.Length > 0)
			{
				common.ImageLoader.GetAdjustedImageSize(markerImage, graph.Graphics, ref size);
			}
			return size;
		}

		private PointF GetMiddlePoint(PointF p1, PointF p2)
		{
			PointF empty = PointF.Empty;
			empty.X = (p1.X + p2.X) / 2f;
			empty.Y = (p1.Y + p2.Y) / 2f;
			return empty;
		}

		public virtual int GetNumerOfSectors(ChartArea area, SeriesCollection seriesCollection)
		{
			int num = 0;
			foreach (Series series in seriesCollection)
			{
				if (series.IsVisible() && (series.ChartArea == area.Name))
				{
					num = Math.Max(series.Points.Count, num);
				}
			}
			return num;
		}

		protected virtual PointF[] GetPointsPosition(ChartGraphics graph, ChartArea area, Series series)
		{
			PointF[] tfArray = new PointF[series.Points.Count + 1];
			int pointIndex = 0;
			foreach (DataPoint point in series.Points)
			{
				double axisValue = this.GetYValue(this.Common, area, series, point, pointIndex, 0);
				double position = area.AxisY.GetPosition(axisValue);
				double x = area.circularCenter.X;
				tfArray[pointIndex] = graph.GetAbsolutePoint(new PointF((float)x, (float)position));
				float angle = (360f / ((float)area.CircularSectorsNumber)) * pointIndex;
				Matrix matrix = new Matrix();
				matrix.RotateAt(angle, graph.GetAbsolutePoint(area.circularCenter));
				PointF[] pts = new PointF[] { tfArray[pointIndex] };
				matrix.TransformPoints(pts);
				tfArray[pointIndex] = pts[0];
				pointIndex++;
			}
			tfArray[pointIndex] = graph.GetAbsolutePoint(area.circularCenter);
			return tfArray;
		}

		public virtual float[] GetYAxisLocations(ChartArea area)
		{
			float[] numArray = new float[area.CircularSectorsNumber];
			float num = 360f / ((float)numArray.Length);
			for (int i = 0; i < numArray.Length; i++)
			{
				numArray[i] = num * i;
			}
			return numArray;
		}

		public virtual double GetYValue(CommonElements common, ChartArea area, Series series, DataPoint point, int pointIndex, int yValueIndex)
		{
			if (yValueIndex == -1)
			{
				return 0.0;
			}
			if (!point.IsEmpty)
			{
				return point.YValues[yValueIndex];
			}
			double emptyPointValue = this.GetEmptyPointValue(point, pointIndex);
			if (emptyPointValue == 0.0)
			{
				Axis axis = area.GetAxis(AxisName.Y, series.YAxisType, series.YSubAxisName);
				double maximum = axis.maximum;
				double minimum = axis.minimum;
				if (emptyPointValue < minimum)
				{
					return minimum;
				}
				if (emptyPointValue > maximum)
				{
					emptyPointValue = maximum;
				}
			}
			return emptyPointValue;
		}

		public virtual void Paint(ChartGraphics graph, CommonElements common, ChartArea area, Series seriesToDraw)
		{
			this.Common = common;
			this.Area = area;
			this.ProcessChartType(false, graph, common, area, seriesToDraw);
		}

		protected virtual void ProcessChartType(bool selection, ChartGraphics graph, CommonElements common, ChartArea area, Series seriesToDraw)
		{
			foreach (Series series in common.DataManager.Series)
			{
				if ((series.ChartArea != area.Name) || !series.IsVisible())
				{
					continue;
				}
				if (string.Compare(series.ChartTypeName, this.Name, true, CultureInfo.CurrentCulture) != 0)
				{
					throw new InvalidOperationException(SR.ExceptionChartTypeCanNotCombine(series.ChartTypeName, this.Name));
				}
				if (!selection)
				{
					common.Chart.CallOnPrePaint(new ChartPaintEventArgs(series, graph, common, area.PlotAreaPosition));
				}
				Axis axis = area.GetAxis(AxisName.Y, AxisType.Primary, series.YSubAxisName);
				double viewMinimum = axis.ViewMinimum;
				double viewMaximum = axis.ViewMaximum;
				PointF[] dataPointPos = this.GetPointsPosition(graph, area, series);
				int index = 0;
				if ((series.ShadowOffset != 0) && !selection)
				{
					foreach (DataPoint point in series.Points)
					{
						int num4 = index + 1;
						if (num4 >= series.Points.Count)
						{
							num4 = 0;
						}
						DataPointCustomProperties properties = point;
						if (series.Points[num4].IsEmpty)
						{
							properties = series.Points[num4];
						}
						Color transparent = properties.Color;
						Color borderColor = properties.BorderColor;
						int borderWidth = properties.BorderWidth;
						ChartDashStyle borderDashStyle = properties.BorderDashStyle;
						RadarDrawingStyle drawingStyle = this.GetDrawingStyle(series, point);
						if (((axis.GetLogValue(point.YValues[0]) > viewMaximum) || (axis.GetLogValue(point.YValues[0]) < viewMinimum)) || ((axis.GetLogValue(series.Points[num4].YValues[0]) > viewMaximum) || (axis.GetLogValue(series.Points[num4].YValues[0]) < viewMinimum)))
						{
							index++;
							continue;
						}
						switch (drawingStyle)
						{
							case RadarDrawingStyle.Line:
								{
									Color color5 = properties.Color;
									borderWidth = (borderWidth < 1) ? 1 : borderWidth;
									borderDashStyle = (borderDashStyle == ChartDashStyle.NotSet) ? ChartDashStyle.Solid : borderDashStyle;
									transparent = Color.Transparent;
									break;
								}
							case RadarDrawingStyle.Marker:
								transparent = Color.Transparent;
								break;
						}
						if (((num4 == 0) && !this.RequireClosedFigure()) && (drawingStyle != RadarDrawingStyle.Area))
						{
							break;
						}
						if (((transparent != Color.Transparent) && (transparent != Color.Empty)) && (series.ShadowOffset != 0))
						{
							using (GraphicsPath path = new GraphicsPath())
							{
								path.AddLine(graph.GetAbsolutePoint(area.circularCenter), dataPointPos[index]);
								path.AddLine(dataPointPos[index], dataPointPos[num4]);
								path.AddLine(dataPointPos[num4], graph.GetAbsolutePoint(area.circularCenter));
								Matrix matrix = new Matrix();
								matrix.Translate((float)series.ShadowOffset, (float)series.ShadowOffset);
								path.Transform(matrix);
								using (Brush brush = new SolidBrush(series.ShadowColor))
								{
									graph.FillPath(brush, path);
								}
							}
						}
						index++;
					}
				}
				index = 0;
				foreach (DataPoint point2 in series.Points)
				{
					point2.positionRel = graph.GetRelativePoint(dataPointPos[index]);
					int secondPointIndex = index + 1;
					if (secondPointIndex >= series.Points.Count)
					{
						secondPointIndex = 0;
					}
					DataPointCustomProperties properties2 = point2;
					if (series.Points[secondPointIndex].IsEmpty)
					{
						properties2 = series.Points[secondPointIndex];
					}
					Color color = properties2.Color;
					Color color3 = properties2.BorderColor;
					int width = properties2.BorderWidth;
					ChartDashStyle style = properties2.BorderDashStyle;
					RadarDrawingStyle style4 = this.GetDrawingStyle(series, point2);
					if (((axis.GetLogValue(point2.YValues[0]) > viewMaximum) || (axis.GetLogValue(point2.YValues[0]) < viewMinimum)) || ((axis.GetLogValue(series.Points[secondPointIndex].YValues[0]) > viewMaximum) || (axis.GetLogValue(series.Points[secondPointIndex].YValues[0]) < viewMinimum)))
					{
						index++;
						continue;
					}
					if (style4 == RadarDrawingStyle.Line)
					{
						color3 = properties2.Color;
						width = (width < 1) ? 1 : width;
						style = (style == ChartDashStyle.NotSet) ? ChartDashStyle.Solid : style;
						color = Color.Transparent;
					}
					else if (style4 == RadarDrawingStyle.Marker)
					{
						color = Color.Transparent;
					}
					using (GraphicsPath path2 = new GraphicsPath())
					{
						if (((secondPointIndex == 0) && !this.RequireClosedFigure()) && (style4 != RadarDrawingStyle.Area))
						{
							if (common.ProcessModeRegions)
							{
								this.AddSelectionPath(area, path2, dataPointPos, index, secondPointIndex, graph.GetAbsolutePoint(area.circularCenter), 0);
								int insertIndex = common.HotRegionsList.FindInsertIndex();
								common.HotRegionsList.AddHotRegion(insertIndex, path2, false, graph, point2, series.Name, index);
							}
							break;
						}
						if ((color != Color.Transparent) && (color != Color.Empty))
						{
							using (GraphicsPath path3 = new GraphicsPath())
							{
								path3.AddLine(graph.GetAbsolutePoint(area.circularCenter), dataPointPos[index]);
								path3.AddLine(dataPointPos[index], dataPointPos[secondPointIndex]);
								path3.AddLine(dataPointPos[secondPointIndex], graph.GetAbsolutePoint(area.circularCenter));
								if (common.ProcessModePaint)
								{
									using (Brush brush2 = graph.CreateBrush(path3.GetBounds(), color, properties2.BackHatchStyle, properties2.BackImage, properties2.BackImageWrapMode, properties2.BackImageTransparentColor, properties2.BackGradientStyle, properties2.BackSecondaryColor))
									{
										graph.StartHotRegion(point2);
										graph.FillPath(brush2, path3);
										graph.EndHotRegion();
									}
								}
							}
							if (common.ProcessModeRegions)
							{
								this.AddSelectionPath(area, path2, dataPointPos, index, secondPointIndex, graph.GetAbsolutePoint(area.circularCenter), 0);
							}
						}
						if (((color3 != Color.Empty) && (width > 0)) && ((style != ChartDashStyle.NotSet) && (secondPointIndex < series.Points.Count)))
						{
							if (common.ProcessModePaint)
							{
								graph.StartHotRegion(point2);
								graph.DrawLineAbs(color3, width, style, dataPointPos[index], dataPointPos[secondPointIndex], series.ShadowColor, ((color == Color.Transparent) || (color == Color.Empty)) ? series.ShadowOffset : 0);
								graph.EndHotRegion();
							}
							if (common.ProcessModeRegions)
							{
								this.AddSelectionPath(area, path2, dataPointPos, index, secondPointIndex, PointF.Empty, width);
							}
						}
						if (common.ProcessModeRegions)
						{
							int num9 = common.HotRegionsList.FindInsertIndex();
							common.HotRegionsList.AddHotRegion(num9, path2, false, graph, point2, series.Name, index);
						}
					}
					index++;
				}
				int num10 = 0;
				index = 0;
				foreach (DataPoint point3 in series.Points)
				{
					Color markerColor = point3.MarkerColor;
					MarkerStyle markerStyle = point3.MarkerStyle;
					RadarDrawingStyle style6 = this.GetDrawingStyle(series, point3);
					if ((axis.GetLogValue(point3.YValues[0]) > viewMaximum) || (axis.GetLogValue(point3.YValues[0]) < viewMinimum))
					{
						index++;
						continue;
					}
					if ((style6 == RadarDrawingStyle.Marker) && markerColor.IsEmpty)
					{
						markerColor = point3.Color;
					}
					SizeF size = this.GetMarkerSize(graph, common, area, point3, point3.MarkerSize, point3.MarkerImage);
					if (common.ProcessModePaint)
					{
						if ((markerStyle != MarkerStyle.None) || (point3.MarkerImage.Length > 0))
						{
							if (markerColor.IsEmpty)
							{
								markerColor = point3.Color;
							}
							if (num10 == 0)
							{
								graph.StartHotRegion(point3);
								graph.DrawMarkerAbs(dataPointPos[index], markerStyle, (int)size.Height, markerColor, point3.MarkerBorderColor, point3.MarkerBorderWidth, point3.MarkerImage, point3.MarkerImageTransparentColor, (point3.series != null) ? point3.series.ShadowOffset : 0, (point3.series != null) ? point3.series.ShadowColor : Color.Empty, new RectangleF(dataPointPos[index].X, dataPointPos[index].Y, size.Width, size.Height), false);
								graph.EndHotRegion();
							}
							num10++;
							if (series.MarkerStep == num10)
							{
								num10 = 0;
							}
						}
						this.DrawLabels(area, graph, common, dataPointPos[index], (int)size.Height, point3, series, index);
					}
					if (common.ProcessModeRegions)
					{
						SizeF relativeSize = graph.GetRelativeSize(size);
						PointF relativePoint = graph.GetRelativePoint(dataPointPos[index]);
						int num11 = common.HotRegionsList.FindInsertIndex();
						if (point3.MarkerStyle == MarkerStyle.Circle)
						{
							float[] numArray = new float[] { relativePoint.X, relativePoint.Y, relativeSize.Width / 2f };
							common.HotRegionsList.AddHotRegion(num11, graph, numArray[0], numArray[1], numArray[2], point3, series.Name, index);
						}
						else
						{
							common.HotRegionsList.AddHotRegion(new RectangleF(relativePoint.X - (relativeSize.Width / 2f), relativePoint.Y - (relativeSize.Height / 2f), relativeSize.Width, relativeSize.Height), point3, series.Name, index);
						}
					}
					index++;
				}
				if (!selection)
				{
					common.Chart.CallOnPrePaint(new ChartPaintEventArgs(series, graph, common, area.PlotAreaPosition));
				}
			}
		}

		public virtual bool RadialGridLinesSupported()
		{
			return false;
		}

		public virtual bool RequireClosedFigure()
		{
			return true;
		}

		public virtual bool XAxisCrossingSupported()
		{
			return false;
		}

		public virtual bool XAxisLabelsSupported()
		{
			return false;
		}

		public virtual bool ApplyPaletteColorsToPoints
		{
			get
			{
				return false;
			}
		}

		internal ChartArea Area { set; get; }

		public bool CircularChartArea
		{
			get
			{
				return true;
			}
		}

		internal CommonElements Common { set; get; }

		public virtual bool DataPointsInLegend
		{
			get
			{
				return false;
			}
		}

		public virtual bool ExtraYValuesConnectedToYAxis
		{
			get
			{
				return false;
			}
		}

		public virtual bool HundredPercent
		{
			get
			{
				return false;
			}
		}

		public virtual bool HundredPercentSupportNegative
		{
			get
			{
				return false;
			}
		}

		public virtual string Name
		{
			get
			{
				return "Radar";
			}
		}

		public virtual bool RequireAxes
		{
			get
			{
				return true;
			}
		}

		public bool SecondYScale
		{
			get
			{
				return false;
			}
		}

		public virtual bool SideBySideSeries
		{
			get
			{
				return false;
			}
		}

		public virtual bool Stacked
		{
			get
			{
				return false;
			}
		}

		public bool StackSign
		{
			get
			{
				return false;
			}
		}

		public virtual bool SupportLogarithmicAxes
		{
			get
			{
				return false;
			}
		}

		public virtual bool SupportStackedGroups
		{
			get
			{
				return false;
			}
		}

		public virtual bool SwitchValueAxes
		{
			get
			{
				return false;
			}
		}

		public virtual int YValuesPerPoint
		{
			get
			{
				return 1;
			}
		}

		public virtual bool ZeroCrossing
		{
			get
			{
				return false;
			}
		}
	}
}

